function add(){
            var $html ='<tr>' +
                '<td class="form-group has-error" ><input type="text" class="form-control has-error" name="p[name][]" placeholder="参数名" required="required"></td>' +
                '<td class="form-group has-error" ><input type="text" class="form-control has-error" name="p[prp][]" placeholder="属性" required="required"></td>' +
                '<td>' +
                '<select class="form-control" name="p[type][]">' +
                '<option value="string">string</option><option value="int">int</option><option value="long">long</option><option value="float">float</option><option value="double">double</option><option value="file">file</option>' +
                '</select >' +
                '</td>' +
                '<td>' +
                '<select class="form-control" name="p[must][]">' +
                '<option value="Y">Y</option> <option value="N">N</option>' +
                '</select >' +
                '</td>' +
                '<td>' +
                '<input type="text" class="form-control" name="p[default][]" placeholder="缺省值"></td>' +
                '<td>' +
                '<textarea name="p[des][]" rows="1" class="form-control" placeholder="描述"></textarea>' +
                '</td>' +
                '<td>' +
                '<button type="button" class="btn btn-danger" onclick="del(this)">删除</button>' +
                '</td>' +
                '</tr >';
            $('#parameter').append($html);
        }
        function del(obj){
            if($(obj).parents('tbody').find("tr").size()==1){
				alert("请保留一条记录");
				return;
            }
            $(obj).parents('tr').remove();
        }
		function add_result(tableName){
			$('#table_'+tableName).append(getResultCloneTr(tableName));
		}

		function getResultCloneTr(tableName){
			return "<tr>\
			    <td class='form-group has-error'>\
			        <input type='text' class='form-control' name='r["+tableName+"][name][]' placeholder='参数名' required='required'>\
			    </td>\
			    <td class='form-group has-error'>\
		        <input type='text' class='form-control' name='r["+tableName+"][prp][]' placeholder='属性' required='required'>\
		        </td>\
			    <td>\
			        <select class='form-control' name='r["+tableName+"][type][]'>\
			            <option value='string'>string</option>\
			            <option value='int'>int</option>\
			        	<option value='long'>long</option>\
			            <option value='list'>list</option>\
			        	<option value='array'>array</option>\
			            <option value='object'>object</option>\
			            <option value='float'>float</option>\
			        	<option value='double'>double</option>\
			        	<option value='other'>other</option>\
			        </select>\
			    </td>\
			    <td><input type='text' class='form-control' name='r["+tableName+"][default][]' placeholder='缺省值'></td>\
			    <td><textarea name='r["+tableName+"][des][]' rows='1' class='form-control' placeholder='描述'></textarea></td>\
			    <td><button type='button' class='btn btn-danger' onclick='del(this)'>删除</button></td>\
			</tr>";
		}

		function add_new_table(){
			var tableName  =$("#newTableName").val();
			if(tableName.length==0){
				alert("请输入名称");
				$("#newTableName").focus();
				return;
			}
			
			if($("#div_"+tableName).length>0){
				alert("表格"+tableName+"已存在");
				return;
			}
			var html = "<div class='form-group' id='div_"+tableName+"'><hr>  \
			<h5 style='font-weight: bold;'>"+tableName+"</h5> \
			<table class='table' id='table_"+tableName+"'> \
			<thead><tr>\
			 <th class='col-md-2'>参数名</th>\
			 <th class='col-md-2'>属性</th>\
             <th class='col-md-2'>类型</th>\
             <th class='col-md-2'>缺省值</th>\
             <th class='col-md-2'>描述</th>\
             <th class='col-md-2'>\
                 <button type='button' class='btn btn-success' onclick='add_result(\""+tableName+"\")'>新增</button>\
                 <button type='button' class='btn btn-danger' onclick='$(\"#div_"+tableName+"\").remove()'>删除</button>\
             </th></tr>\
			</thead> \
			<tbody>"+getResultCloneTr(tableName)+"\
			</tbody> \
			</table>\
			</div>";
			$("#lastResult").before(html);
		}
		